package top.leyi.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import top.leyi.entity.pushAndColle.Push;

import java.util.List;

/**
 * @param
 * dest 目标人物的id
 * original 产生的任务的id
 * type 产生任务的类型的名称（class）
 */
public interface PushMapper {

   @Select("SELECT id,type,original,dest,time FROM push where (dest = #{userId} or  (type = '系统通知' and dest = 0)) and is_delete = 0 ")
   public List<Push> getOwnPush(int  userId);

   @Insert("INSERT INTO push(type,original,dest) VALUES (#{type}, #{original}, #{dest})")
   public void addPush(Push push);

   @Delete("UPDATE push SET is_delete = 1 WHERE id = #{id}")
   public void removePush(Push push);

   @Select("SELECT id,type,original,dest,time FROM push where type = '系统通知' and(dest = 0 or dest = #{value}) and is_delete = 0  ")
   public List<Push> getSysPush(int  userId);

}
